<!DOCTYPE html>
<!--
 *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
-->
<html>
<head>

    <meta charset="utf-8">
    <meta name="description" content="WebRTC code samples">
    <meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1, maximum-scale=1">
    <meta itemprop="description" content="Client-side WebRTC code samples">
    <meta itemprop="image" content="../../../images/webrtc-icon-192x192.png">
    <meta itemprop="name" content="WebRTC code samples">
    <meta name="mobile-web-app-capable" content="yes">
    <meta id="theme-color" name="theme-color" content="#ffffff">

    <base target="_blank">

    <title>Record canvas stream</title>

    <link rel="icon" sizes="192x192" href="../../../images/webrtc-icon-192x192.png">
    <!--<link href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet" type="text/css">-->
    <link rel="stylesheet" href="../../../css/main.css">
    <link rel="stylesheet" href="css/main.css">

</head>

<body>

<div id="container">

    <h1><a href="../../../../index.html" title="WebRTC samples homepage">WebRTC samples</a> <span>Record stream from a canvas</span>
    </h1>

    <canvas></canvas>
    <video id="recorded" playsinline loop></video>

    <div>
        <button id="record">Start Recording</button>
        <button id="play" disabled>Play</button>
        <button id="download" disabled>Download</button>
    </div>

    <p>Click and drag on the canvas (on the left) to move the teapot.</p>

    <p>This demo requires Firefox 43 or above, Chrome 51 or above, or Chrome 50 with <strong>Experimental Web Platform
        features</strong> enabled.</p>

    <p>The teapot is drawn on the canvas element using WebGL. A stream is captured from the canvas element using its
        <code>captureStream()</code> method then recorded using the <code>MediaRecorder</code> API.</p>

    <p>The <code>canvas</code>, <code>video</code>, and <code>stream</code> variables are in global scope, so you can
        inspect them from the browser console.</p>

    <p>For more demos and information about <code>captureStream()</code>, see <a
            href="https://docs.google.com/document/d/1JmWfOtUP6ZqsYJ--U8y0OtHkBt-VyjX4N-JqIjb1t78"
            title="Implementation overview doc">Media Capture from Canvas Implementation</a>.</p>

    <p>For more information see the MediaStream Recording API <a
            href="http://w3c.github.io/mediacapture-record/MediaRecorder.html"
            title="W3C MediaStream Recording API Editor's Draft">Editor's&nbsp;Draft</a>.</p>
    <a href="https://github.com/webrtc/samples/tree/gh-pages/src/content/capture/canvas-record"
       title="View source for this page on GitHub" id="viewSource">View source on GitHub</a>

</div>

<!-- Teapot code -->
<script src="../../../js/third_party/webgl_teapot/webgl-utils.js"></script>
<script src="../../../js/third_party/webgl_teapot/webgl-debug.js"></script>
<script src="../../../js/third_party/webgl_teapot/matrix4x4.js"></script>
<script src="../../../js/third_party/webgl_teapot/cameracontroller.js"></script>
<script src="../../../js/third_party/webgl_teapot/teapot-streams.js"></script>
<script src="../../../js/third_party/webgl_teapot/demo.js"></script>

<!-- include adapter for srcObject shim -->
<script src="../../../js/adapter-latest.js"></script>
<script src="js/main.js"></script>
<!--<script src="../../../js/lib/ga.js"></script>-->

</body>
</html>
